package com.imot.handler;
import com.imot.pojo.entity.EmaRecord;

import java.io.*;
import java.net.Socket;
/**
 * ClassName: Test
 * Description:
 * date: 2023/11/13 15:01
 *
 * @author imot-jiah.wang
 */
public class Test {
    public static void main(String[] args) throws IOException {
        String hostname = "localhost"; // 服务器的主机名或 IP 地址
        int port = 12020; // 服务器的端口号

        Socket socket = new Socket(hostname, port);
        System.out.println("Connected to the server");

        OutputStream output = socket.getOutputStream();
        PrintWriter writer = new PrintWriter(output, true);
        String jsonString = "[\n" +
                "  {\n" +
                "    \"temperature\": -10.0,\n" +
                "    \"speed\": 3456,\n" +
                "    \"acceleration\": 1.0,\n" +
                "    \"supplyVoltage\": 26.0,\n" +
                "    \"motorCurrent\": 16,\n" +
                "    \"motorSpeed\": 2500,\n" +
                "    \"displacement\": -50.0,\n" +
                "    \"thrust\": 2568,\n" +
                "    \"time\": \"2023-09-01T00:00:01\",\n" +
                "    \"elecTorque\": 10\n" +
                "  },\n" +
                "  {\n" +
                "    \"temperature\": 20.0,\n" +
                "    \"speed\": 4551,\n" +
                "    \"acceleration\": 2.0,\n" +
                "    \"supplyVoltage\": 24.0,\n" +
                "    \"motorCurrent\": 16,\n" +
                "    \"motorSpeed\": 3200,\n" +
                "    \"displacement\": 40.0,\n" +
                "    \"thrust\": 1501,\n" +
                "    \"time\": \"2023-09-05T04:00:05\",\n" +
                "    \"elecTorque\": 10\n" +
                "  },\n" +
                "  {\n" +
                "    \"temperature\": -16.0,\n" +
                "    \"speed\": 2000,\n" +
                "    \"acceleration\": 2.0,\n" +
                "    \"supplyVoltage\": 22.0,\n" +
                "    \"motorCurrent\": 15,\n" +
                "    \"motorSpeed\": 4600,\n" +
                "    \"displacement\": -76.0,\n" +
                "    \"thrust\": 2250,\n" +
                "    \"time\": \"2023-09-06T05:00:06\",\n" +
                "    \"elecTorque\": 10\n" +
                "  }\n" +
                "]";

        EmaRecord emaRecord = new EmaRecord();

        writer.println(jsonString);

        socket.close();

    }
}

